﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FightTheDragon.Interface;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using FightTheDragon.Managers;

namespace FightTheDragon.Interface
{
    class Text : BaseInterfaceObjects
    {

        
        
        private string m_SpriteFont;
        public string SpriteFont
        {
            get { return m_SpriteFont; }
            set { m_SpriteFont = value; }
        }
        private string m_TextToDisplay;
        public string TextToDisplay
        {
            get { return m_TextToDisplay; }
            set { m_TextToDisplay = value; }
        }
        private string m_ExtraText;
        public string ExtraText
        {
            get { return m_ExtraText; }
            set { m_ExtraText = value; }
        }
        private Vector2 m_Measure;
        public Vector2 Measure
        {
            get { return m_Measure; }
            set { m_Measure = value; }
        }
        private FontEffects m_type;
        public FontEffects Type
        {
            get { return m_type; }
            set { m_type = value; }
        }


        public Text()
        {
            Position = new Vector2();
            Rotate = 0;
            RotationRate = 0;
            m_SpriteFont = null;
            m_Measure = new Vector2();
            Color = new Color();
            TextToDisplay = null;
            Scale = 0;
            Origin = new Vector2();
            m_type = null;


        }

        public Text(int x, int y, float rot, string Font, string TextToShow, float scale, Color c, float Rate, FontEffects E)
        {
            Rotate = rot;
            SpriteFont  temp = GlobalContentManager.Instance.Font(Font);
            m_SpriteFont = Font;
            m_Measure = temp.MeasureString(TextToShow);
            Scale = scale;
            TextToDisplay = TextToShow;
            RotationRate = Rate;
            Color = c;
            m_type = E;
            Position = new Vector2(x, y);
            
            Origin = new Vector2(m_Measure.X/2,m_Measure.Y/2);
            m_type.Init(this);
            
        }
        public override void Render()
        {
           
            GlobalContentManager.Instance.Sprites.DrawString(GlobalContentManager.Instance.Font(m_SpriteFont),
                TextToDisplay, Position, Color,Rotate*3.14f/180,Origin,Scale,0,0);
        }
        public override void  Update(float gTime)
        {
            m_type.ApplyEffect(this);
        }
        
    }
}
